﻿HmJS.$Import('ui.Picker.Attach');
//HmJS.$Import('core.domready');

HmJS.register('demo.module.ui.calendar.datepicker.pickerattach', function ($ns) {
	var that = {};

	that.todo = function () {

		var Picker = $ns.ui.Picker;

		var myPicker = new Picker.Attach($$('a.open, input:not(#dontBlockKeydown)'), {
			toggles: $$('toggles'),
			positionOffset: { x: -10, y: 20 }
		});

		$('open').addEvent('click', function (e) {
			e.stop();
			myPicker.open();
		});
		$('close').addEvent('click', function (e) {
			e.stop();
			myPicker.close();
		});
		$('toggle').addEvent('click', function (e) {
			e.stop();
			myPicker.toggle();
		});

		// tests blockKeydown option
		new Picker.Attach('dontBlockKeydown', {
			blockKeydown: false
		});

	};

	return that;
});
